package com.ruoyi.fly.enums;


import lombok.Getter;
import lombok.Setter;

public enum SettingType {

    USER_POLICY(1, "用户政策"),
    PRIVACY_AGREEMENT(2, "隐私协议"),
    VIP_POLICY(3, "vip政策"),
    SHARING_RULE(4, "分享规则");

    @Setter @Getter
    private Integer code;
    @Setter @Getter
    private String desc;


    SettingType(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

//    public static StoreStatus findByCode(Integer code) {
//        Optional<StoreStatus> first = Arrays.stream(StoreStatus.values()).filter(item -> item.getCode().equals(code)).findFirst();
//        first.orElseGet(()->{
//
//            return   StoreStatus.REPAIR;
//        });
//        return first.orElse(null);
//    }

    public static String getValue(Integer code) {
        if (code == null) {
            return "";
        }
        for (SettingType value : SettingType.values()) {
            if (value.code.equals(code)){
                return value.desc;
            }
        }
        return "";
    }



}
